package com.xoa.controller.workflow;

import com.xoa.model.workflow.FlowOperation;
import com.xoa.service.workflow.FlowOperation.FlowOperationService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

//关联操作设置
@Controller
@RequestMapping("/operation")
public class FlowOperationController {
    @Autowired
    private FlowOperationService flowOperationService;

    @RequestMapping("/index")
    public String index() {
        return "app/workflow/FlowOperation/FlowOperations";
    }

    //查询所有
    @ResponseBody
    @RequestMapping("/selectAllFlowOperation")
    public ToJson<FlowOperation> selectAllFlowOperation() {
        return flowOperationService.selectAllFlowOperation();
    }

    //添加
    @ResponseBody
    @RequestMapping("/insertFlowOperation")
    public ToJson<FlowOperation> insertFlowOperation(FlowOperation flowOperation, HttpServletRequest request) {
        return flowOperationService.insertFlowOperation(flowOperation, request);
    }

    //根据id删除信息
    @ResponseBody
    @RequestMapping("/delFlowOperation")
    public ToJson<FlowOperation> delFlowOperation(Integer opId) {
        return flowOperationService.delFlowOperation(opId);
    }

    //根据id查询单条信息
    @ResponseBody
    @RequestMapping("/selFlowOperationById")
    public ToJson<FlowOperation> selRelationFuncById(Integer opId) {
        return flowOperationService.selFlowOperationById(opId);
    }

    //根据id更新信息
    @ResponseBody
    @RequestMapping("/updateFlowOperationById")
    public ToJson<FlowOperation> updateFlowOperationById(FlowOperation flowOperation, HttpServletRequest request) {
        return flowOperationService.updateFlowOperationById(flowOperation, request);
    }
}
